package gr.atc.epart.googlewrapper.moderator;

import gr.atc.epart.googlewrapper.moderator.Attribution;

import java.util.Date;
import java.util.HashMap;

public class ModeratorSubmission
{
	public static final String PLUS_VOTES = "plusVotes";
	public static final String MINUS_VOTES = "minusVotes";
	public static final String NONE_VOTES = "noneVotes";

	private int _id;
	private int _ownerTopic;
	private int _ownerSeriesId;
	private HashMap<String, Integer> _counters;
	private String	_text;
	private Attribution _attribution;
	private String _attachmentUrl;
	private Date  _creationDate;
	 
	public ModeratorSubmission(int id,int ownerTopic, int ownerSeriesId)
	{
		_id = id;
		_ownerTopic = ownerTopic;
		_ownerSeriesId = ownerSeriesId;
		_counters = new HashMap<String, Integer>();

		_counters.put(PLUS_VOTES, 0);
		_counters.put(MINUS_VOTES, 0);
		_counters.put(NONE_VOTES, 0);

	}

	public int getId()
	{
		return _id;
	}
	
	public int getOnwerTopic()
	{
		return _ownerTopic;
	}
	
	public int getOnwerSeriesId()
	{
		return _ownerSeriesId;
	}

	public void setText(String text)
	{
		_text = text;
	}
	
	public String getText()
	{
		return _text;
	}
	
	public void setcounter(String tag,int value)
	{
		if (_counters.containsKey(tag))
		{
			_counters.put(tag, value);
		}
	}
	
	public int getCounter(String tag) throws Exception
	{
		if (_counters.containsKey(tag))
		{
			return _counters.get(tag);
		}
		else
		{
			throw new Exception("Counter name not be recognised");
		}
			
	}

	public void setAttachementUrl(String attachmentUrl)
	{
		_attachmentUrl = attachmentUrl;
	}
	
	public String getAttachmentUrl()
	{
		return _attachmentUrl;
	}
	
	public void setAttribution(Attribution attribution)
	{
		_attribution = attribution;
	}
	
	public Attribution getAttribution()
	{
		return _attribution;
	}
	
	public void setCreationDate(Date creationDate)
	{
		_creationDate = creationDate;
	}
	
	public Date getCreationDate()
	{
		return _creationDate;
	}
}
